from django.http import HttpResponse, StreamingHttpResponse, JsonResponse
from django.shortcuts import render, redirect
import os,time,sys

# Create your views here.

def login(request):
    if request.method == "GET":
        return render(request, 'login.html')
    elif request.method == "POST":
        username = request.POST.get("username", None)
        password = request.POST.get("password", None)

        if username == "admin" and password == "000000":
            # return HttpResponse("登陆成功")
            # return redirect(hello)
            # return redirect("http://qq.com")
            return redirect("/")  # 登录成功后跳转到首页
        else:
            msg = "错误"
            return render(request, 'login.html', {'msg': msg})

def main(request):
    return render(request,'main.html')